<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=no">
    <title>我要入党</title>
    <!-- Link Swiper's CSS -->
    <link rel="stylesheet" href="js/layui-v2.4.5/css/layui.css">
    <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
    <link rel="stylesheet" href="css/public.css">
    <style>
        .personal_title {
            position: fixed;
            top: 0;
            color: #fff;
            background: linear-gradient(to right, #48aefd, #1095fc);
            height: 1rem;
            width: 100%;
            line-height: 1rem;
            font-size: 0.32rem;
            z-index: 1000;
            text-align: center;
        }

        .content {
            padding: 0.2rem;
            margin-bottom: 1rem;
        }

        .step {
            text-align: center;
            display: inline-block;
        }

        .step div {
            display: inline-block;
        }

        .step > div {
            margin-left: -0.12rem;
        }

        .step .baidian {
            width: 0.12rem;
            height: 0.12rem;
            background: #ffffff;
            border-radius: 0.1rem;
            vertical-align: middle;
        }

        .step .line1 {
            width: 1.9rem;
            height: 0.1rem;
            background-image: linear-gradient(to right, #3498db, #34badb);

        }

        .step .line2 {
            width: 1.9rem;
            height: 0.1rem;
            background-image: linear-gradient(to right, #34badb, #34dbd5);
        }

        .step .line3 {
            width: 1.9rem;
            height: 0.1rem;
            background-image: linear-gradient(to right, #34dbd5, #29db9a);
        }

        .dian1 {
            width: 0.24rem;
            height: 0.24rem;
            background: #3498db;
            border-radius: 0.24rem;
            float: left;
            margin: 0.02rem -0.06rem 0 0;
        }

        .dian2 {
            width: 0.24rem;
            height: 0.24rem;
            background: #34badb;
            border-radius: 0.24rem;
            float: left;
            margin: 0.02rem -0.06rem 0 0;
        }

        .dian3 {
            width: 0.24rem;
            height: 0.24rem;
            background: #34dbd5;
            border-radius: 0.24rem;
            float: left;
            margin: 0.02rem -0.06rem 0 0;
        }

        .dian4 {
            width: 0.24rem;
            height: 0.24rem;
            background: #29db9a;
            border-radius: 0.24rem;
            float: left;
            margin: 0.02rem -0.06rem 0 0;
        }

        .step_txt {
            text-align: center;
            margin-bottom: 0.2rem;
            display: flex;
        }

        .step_txt div {
            display: inline-block;
            font-size: 0.28rem;
            line-height: 0.3rem;
        }

        .txt1 {
            margin-left: 0.2rem;
        }

        .txt2 {
            margin-left: 0.8rem;
        }

        .txt3 {
            margin-left: 0.9rem;
        }

        .txt4 {
            margin-left: 0.8rem;
        }

        .top_progress {
            margin-top: 1rem;
            padding: 0.6rem 0;
            border-bottom: 1px solid #ccc;
            box-shadow: 0 1px 3px #ccc;
        }

        .head_photo {
            width: 2.5rem;
            height: 3.5rem;
            background: url(image/public_wyrd_upload.png) center no-repeat;
            background-color: #f4f4f4;
            margin-top: 0.2rem;
        }

        .from_item {
            font-size: 0.28rem;
            line-height: 0.4rem;
            color: #333;
            border-bottom: 1px solid #f4f4f4;
            padding: 0.3rem 0;
        }

        .item_title {
            font-size: 0.32rem;
            font-weight: bold;
            color: #000;
        }

        .item_val {

        }

        .item_val > span {
            display: inline-block;
            vertical-align: bottom;
        }

        .item_lab {
            width: 1.7rem;
            display: inline-block;
            color: #666;
        }

        input[type='text'] {
            margin-left: 0;
            background: #fff;
            text-indent: 0;
            height: 0.4rem;
            line-height: 0.4rem;
        }

        #my_button {
            width: 3.8rem;
            height: 0.8rem;
            border-radius: 0.1rem;
            font-size: 0.3rem;
            line-height: 0.8rem;
            text-align: center;
            /*color: #fff;*/
            /*background: linear-gradient(to left,#1095fc ,#48aefd);*/
            background: #e6e6e6;
            color: #999;
            margin: 0.4rem auto 0;
        }
    </style>
</head>
<body>
<div class="app">
    <!--顶部返回栏-->
    <div class="personal_title">
        <span style="position: absolute;left: 0.2rem;line-height: 1rem;font-size: 0.4rem;"
              class="el-icon-arrow-left"></span>
        <span>我要入党</span>
    </div>

    <div class="top_progress">
        <div class="step_txt">
            <div>
                <div class="txt1" style="color: #3498db;">
                    基本信息
                </div>
            </div>
            <div>
                <div class="txt2" style="color: #34badb;">
                    个人经历
                </div>
            </div>
            <div>
                <div class="txt3" style="color: #34dbd5;">
                    家庭情况
                </div>
            </div>
            <div>
                <div class="txt4" style="color: #34dbd5;">
                    入党原因
                </div>
            </div>
        </div>
        <!-- data-i 123  表示进度，文字内容在step_txt中-->
        <div class="step" style="text-align: center" data-i="1">
            <div style="margin-left: 0.5rem;">
                <div class="line1"></div>
                <div class="dian1">
                    <div class="baidian"></div>
                </div>
            </div>
            <div>
                <div class="line2"></div>
                <div class="dian2">
                    <div class="baidian"></div>
                </div>
            </div>
            <div>
                <div class="line3"></div>
                <div class="dian3">
                    <div class="baidian"></div>
                </div>
            </div>
            <div>
                <div style="width: 0;"></div>
                <div class="dian4">
                    <div class="baidian"></div>
                </div>
            </div>
        </div>
    </div>

    <!--内容-->
    <div class="content">
        <!--头像选择-->
        <div class="from_item">
            <div class="item_title">基本信息</div>
            <div class="item_val">
                <img class="head_photo" onclick="$('input.head').click()">
                <input id="head" class="head" type="file" name="head" accept="image/png,image/jpg,image/jpeg"
                       style="display: none;" onchange="changeToop();">
                <span>
                    点击选框 上传一寸照照片 <br>
                    <span style="font-size: 0.2rem;color: #999;">图片为png 或 jpg格式 大小不得超过300kb</span>
                </span>
            </div>
        </div>
        <!--姓名-->
        <div class="from_item">
            <div class="item_lab">姓名</div>
            <input name="xm" type="text" placeholder="请输入姓名">
        </div>
        <!--性别-->
        <div class="from_item">
            <div class="item_lab">性别</div>
            <input name="xb" type="text" placeholder="请输入性别">
        </div>
        <!--出生年月-->
        <div class="from_item">
            <div class="item_lab">出生年月</div>
            <input name="csny" type="text" placeholder="请输入出生年月">
        </div>
        <!--民族-->
        <div class="from_item">
            <div class="item_lab">民族</div>
            <input name="mz" type="text" placeholder="请输入民族">
        </div>
        <!--籍贯-->
        <div class="from_item">
            <div class="item_lab">籍贯</div>
            <input name="jg" type="text" placeholder="请输入籍贯">
        </div>
        <!--出生地-->
        <div class="from_item">
            <div class="item_lab">出生地</div>
            <input name="csd" type="text" placeholder="请输入出生地">
        </div>
        <!--学历-->
        <div class="from_item">
            <div class="item_lab">学历</div>
            <input name="xl" type="text" placeholder="请输入学历">
        </div>
        <!--身份证-->
        <div class="from_item">
            <div class="item_lab">身份证</div>
            <input name="sfz" type="text" placeholder="请输入身份证">
        </div>
        <!--现居住地-->
        <div class="from_item">
            <div class="item_lab">现居住地</div>
            <input name="xjzd" type="text" placeholder="请输入现居住地">
        </div>
        <!--工作单位-->
        <div class="from_item">
            <div class="item_lab">工作单位</div>
            <input name="gzdw" type="text" placeholder="请输入工作单位">
        </div>

        <div id="my_button">下一步</div>
    </div>
</div>

<!-- JS -->
<script src="js/jquery-3.4.0/jquery-3.4.0.min.js"></script>
<script src="js/layui-v2.4.5/layui.all.js"></script>
<script src="js/public.js"></script>
<script type="text/javascript">
    let i = $(".step").get(0).dataset['i'];
    switch (i) {
        case "1":
            $(".dian2").get(0).style.background = "#bdbdbd";
            $(".dian3").get(0).style.background = "#dddddd";
            $(".dian4").get(0).style.background = "#eee";

            $(".txt2").get(0).style.color = "#bdbdbd";
            $(".txt3").get(0).style.color = "#dddddd";
            $(".txt4").get(0).style.color = "#dddddd";

            $(".line1").get(0).style.background = "linear-gradient(to right, rgb(52, 152, 219),#bdbdbd)";
            $(".line2").get(0).style.background = "linear-gradient(to right, #bdbdbd,#dddddd)";
            $(".line3").get(0).style.background = "linear-gradient(to right, #dddddd,#eee)";
            break;
        case "2":
            $(".dian3").get(0).style.background = "#dddddd";
            $(".dian4").get(0).style.background = "#eee";

            $(".txt3").get(0).style.color = "#dddddd";
            $(".txt4").get(0).style.color = "#dddddd";

            $(".line2").get(0).style.background = "linear-gradient(to right, #34badb,#dddddd)";
            $(".line3").get(0).style.background = "linear-gradient(to right, #dddddd,#eee)";
            break;
        case "3":
            $(".dian4").get(0).style.background = "#eee";
            $(".txt4").get(0).style.color = "#dddddd";
            $(".line3").get(0).style.background = "linear-gradient(to right, #34dbd5,#eee)";
            break;
        case "4":
            break;
    }

    function changeToop() {
        var file = $("input.head").get(0);
        if (file.value == '') {
            //设置默认图片
            $("img.head_photo").get(0).src = 'image/public_wyrd_upload.png';
        } else {
            $("img.head_photo").get(0).src = getFileUrl("head")
        }
    }

    function getFileUrl(fileId) {
        let url;
        let file = document.getElementById(fileId);
        let agent = navigator.userAgent;
        if (agent.indexOf("MSIE") >= 1) {
            url = file.value;
        } else if (agent.indexOf("Firefox") > 0) {
            url = window.URL.createObjectURL(file.files.item(0));
        } else if (agent.indexOf("Chrome") > 0) {
            url = window.URL.createObjectURL(file.files.item(0));
        } else if (agent.indexOf("AppleWebKit") > 0) {
            url = window.URL.createObjectURL(file.files.item(0));
        }
        return url;
    }

    $("input[type='text']").bind('input propertychange', button);

    function button() {
        let xm = $("input[name='xm']").val();
        let xb = $("input[name='xb']").val();
        let csny = $("input[name='csny']").val();
        let mz = $("input[name='mz']").val();
        let jg = $("input[name='jg']").val();
        let csd = $("input[name='csd']").val();
        let xl = $("input[name='xl']").val();
        let sfz = $("input[name='sfz']").val();
        let xjzd = $("input[name='xjzd']").val();
        let gzdw = $("input[name='gzdw']").val();
        let DOM = $('#my_button');


        // console.log(xm + xb + csny + mz + jg + csd + xl + sfz + xjzd + gzdw)
        if (xm && xb && csny && mz && jg && csd && xl && sfz && xjzd && gzdw) {
            //不为空
            DOM.css('background', 'linear-gradient(to left,#1095fc ,#48aefd)');
            DOM.css('color', '#fff');
        } else {
            DOM.css('background', '#e6e6e6');
            DOM.css('color', '#999');
        }
    }

    $("#my_button").on("click",function () {
        if ($(this).css('color') === "rgb(255, 255, 255)") {
        let xm = $("input[name='xm']").val();
            let xb = $("input[name='xb']").val();
            let csny = $("input[name='csny']").val();
            let mz = $("input[name='mz']").val();
            let jg = $("input[name='jg']").val();
            let csd = $("input[name='csd']").val();
            let xl = $("input[name='xl']").val();
            let sfz = $("input[name='sfz']").val();
            let xjzd = $("input[name='xjzd']").val();
            let gzdw = $("input[name='gzdw']").val();

            alert( xm + '\n' + xb + '\n' + csny + '\n' + mz + '\n' + jg + '\n' + csd + '\n' + xl + '\n' + sfz + '\n' + xjzd + '\n' + gzdw )
        }else {
            alert('请输入详细信息');
        }
    })
</script>
</body>

</html>
